# This is a sample Python script.
# -*- coding: utf-8 -*-

import mqttclient
import globle

# Press the green button in the gutter to run the script.

if __name__ == '__main__':
    i=0
    while i < globle.node_num:
        globle.vehicleid.append(str(i))   
        i = i + 1
    
    for (part) in globle.vehicleid:
        topic = globle.topic_base + part
        node_id = '/Sub0/' + str(part)
        mqtt_node = mqttclient.MqttClientNode(node_id, globle.host, globle.port)
        mqtt_node.connect_host()
        mqtt_node.subscribe(topic)
        mqtt_node.loop_forver()

